//
//  PointDescriptionTableViewCell.swift
//  ezyform
//
//  Created by MoennigQ on 30/12/19.
//  Copyright © 2019 Client.Solution Pty Ltd. All rights reserved.
//

import UIKit

class PointDescriptionTableViewCell: UITableViewCell {
    let seqNo = BaseLabel()
    let titleLabel = BaseLabel()
    let contentLabel = BaseLabel()
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setUpviews()
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        
    }
    func setUpviews(){
        self.selectionStyle = .none
        self.contentView.backgroundColor = .white
        //
        seqNo.setContentHuggingPriority(.required, for: NSLayoutConstraint.Axis.horizontal)
        seqNo.setContentCompressionResistancePriority(.required, for: NSLayoutConstraint.Axis.horizontal)
        seqNo.textColor = UIColor(hexStr: "#292D32")
        seqNo.setFont(R.font.interBold(size: 15))
        self.contentView.addSubview(seqNo)
        seqNo.snp.makeConstraints { (make) in
            make.left.top.equalToSuperview().offset(20)
            make.width.height.greaterThanOrEqualTo(0)
        }
        //
        titleLabel.textAlignment = .left
        titleLabel.textColor = UIColor(hexStr: "#292D32")
        titleLabel.setFont(R.font.interBold(size: 15))
        titleLabel.numberOfLines = 0
        titleLabel.textAlignment = .left
        self.contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.top.equalTo(seqNo)
            make.left.equalTo(seqNo.snp.right)
            make.right.equalToSuperview().offset(-20)
            make.height.greaterThanOrEqualTo(0)
        }
        //
        contentLabel.textAlignment = .left
        contentLabel.textColor = UIColor(hexStr: "#292D32B3")
        contentLabel.setFont(R.font.interMedium(size: 14))
        contentLabel.numberOfLines = 0
        self.contentView.addSubview(contentLabel)
        contentLabel.snp.makeConstraints { (make) in
            make.top.equalTo(titleLabel.snp.bottom).offset(12)
            make.left.equalTo(titleLabel)
            make.right.equalToSuperview().offset(-20)
            make.height.greaterThanOrEqualTo(0)
            make.bottom.equalToSuperview().offset(-10)
        }
    }
    func setData(_ row: Int, model: PointDescriptionModel){
        self.seqNo.text = "\(row + 1)."
        self.titleLabel.text = model.title
        self.contentLabel.text = model.content
    }
}
